Potential fix for code scanning alert no. 25: DOM text reinterpreted as HTML#208
Merged
lmrodriguezr merged 1 commit intomainfrom Sep 21, 2025
Merged
Potential fix for code scanning alert no. 25: DOM text reinterpreted as HTML#208lmrodriguezr merged 1 commit intomainfrom
lmrodriguezr merged 1 commit intomainfrom
Conversation
…as HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/seq-code/registry/security/code-scanning/25
To fix the error, we must ensure that any value read from
$(this).attr('name')is properly escaped before being inserted into the DOM as part of an attribute value. For this case (fragment identifier), we should sanitize the name so that only valid fragment identifiers are used, ideally restricting the set to a safe subset (e.g.,[A-Za-z0-9\-_:.]+). The best way is to filter and encode the fragment identifier using JavaScript’sencodeURIComponent. This prevents"and other unsafe characters from being misinterpreted or injected into the HTML context. The fix should be applied only to line 23 inapp/views/page/seqcode.html.erb, wrapping the value of$(this).attr('name')inencodeURIComponent(). No external dependencies are required for this fix.Suggested fixes powered by Copilot Autofix. Review carefully before merging.